package com.hongtech.modules.knowledge.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongtech.common.service.impl.CrudServiceImpl;
import com.hongtech.common.util.BeanCopierUtils;
import com.hongtech.modules.knowledge.mapper.DrugTypeMapper;
import com.hongtech.modules.knowledge.dto.DrugTypeDTO;
import com.hongtech.modules.knowledge.entity.DrugTypeEntity;
import com.hongtech.modules.knowledge.service.DrugTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 药品类型表
 *
 * @author admin 123456789@qq.com
 * @since 1.0.0 2023-09-01
 */
@Service
public class DrugTypeServiceImpl extends CrudServiceImpl<DrugTypeMapper, DrugTypeEntity, DrugTypeDTO> implements DrugTypeService {

    @Override
    public List<DrugTypeDTO> listDrugType() {
        LambdaQueryWrapper<DrugTypeEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(DrugTypeEntity::getOrderNumber);
        List<DrugTypeEntity> list = baseDao.selectList(queryWrapper);
        return BeanCopierUtils.copyPropertiesList(list, DrugTypeDTO.class);
    }

}
